package cn.dev.mybatis.bean;

import cn.dev.mybatis.handler.SqlExecutor;

import java.lang.reflect.Parameter;
import java.lang.reflect.Type;

/**
 * sql对象
 *
 * @since 2025-02-11
 */
public class SqlObject {
    private String sql;

    private String originSql;

    private String[] paramNames;

    private Object[] paramValue;

    private final SqlType sqlType;

    private final Parameter[] parameters;

    private final Type retureType;

    private final Type[] actualReturnType;

    private SqlExecutor executor;

    public SqlObject(SqlType sqlType, Parameter[] parameters, Type retureType, Type[] actualReturnType) {
        this.sqlType = sqlType;
        this.parameters = parameters;
        this.retureType = retureType;
        this.actualReturnType = actualReturnType;
    }

    public SqlObject(SqlType sqlType, Parameter[] parameters, Type retureType) {
        this(sqlType, parameters, retureType, null);
    }

    public String getSql() {
        return sql;
    }

    public String getOriginSql() {
        return originSql;
    }

    public String[] getParamNames() {
        return paramNames;
    }

    public Object[] getParamValue() {
        return paramValue;
    }

    public SqlType getSqlType() {
        return sqlType;
    }

    public Parameter[] getParameters() {
        return parameters;
    }

    public Type getRetureType() {
        return retureType;
    }

    public Type[] getActualReturnType() {
        return actualReturnType;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public void setOriginSql(String originSql) {
        this.originSql = originSql;
    }

    public void setParamNames(String[] paramNames) {
        this.paramNames = paramNames;
    }

    public void setParamValue(Object[] paramValue) {
        this.paramValue = paramValue;
    }


    public SqlExecutor getExecutor() {
        return executor;
    }

    public void setExecutor(SqlExecutor executor) {
        this.executor = executor;
    }
}
